package com.cloudkinto.service.stock;

import com.cloudkinto.entity.ProductInfoDo;
import com.cloudkinto.entity.StockRecordDo;
import com.baomidou.mybatisplus.extension.service.IService;

import com.cloudkinto.common.web.PageResult;
import com.cloudkinto.common.web.SingleResult;
import com.cloudkinto.extentity.stock.ShopStockRecordDto;
import com.cloudkinto.service.stock.vo.FreezeStockReq;
import com.cloudkinto.service.stock.vo.record.StockRecordAddReq;
import com.cloudkinto.service.stock.vo.record.StockRecordPageRes;
import com.cloudkinto.service.stock.vo.record.StockRecordSendReq;
import com.cloudkinto.service.stock.vo.record.StockRecordUpdateReq;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * service接口
 * </p>
 *
 * @author 张永远
 * @since 2020-06-10
 */
public interface StockRecordService extends IService<StockRecordDo> {
    SingleResult add(StockRecordAddReq req, Long userId);

    SingleResult update(StockRecordUpdateReq req, Long userId);

    SingleResult addInit();

    SingleResult updateInit(Long id);

    Object update(Object updateVo, Long userId);

    int delete(Long id, Long userId);

    Object detail(Long id);

    SingleResult pageInit(Long companyId, Long userId);

    List<StockRecordPageRes> getList(Map<String, String> map);

    PageResult getListPage(Map<String, String> map);

    SingleResult sendOut(StockRecordSendReq req, Long userId, Long companyId);

    SingleResult sendOutInit();

    //定时每天扣仓储费
    void feeDeduction();

    boolean turn2BadStock(String commoditySku, Long outputShopId, Long outputStorageId, int count, String orderNO, Long userId);

    /**********************库存快照模块**********************/

    PageResult getStockSnapshotPage(Map<String, String> map);

    String exportExcel(Map<String, String> map, String fileName) throws IOException;

    void deduceGoodStock(ProductInfoDo productInfoDo, Long storageId, Long shopId, int quantity, String outOrderNo, Long userId);

    void deduceGoodStock(Long productId, Long storageId, Long shopId, int quantity, String outOrderNo, Long userId);

    void freezeStock(FreezeStockReq req, Long userId);

    void freezeStock(Long productId, Long storageId, Long shopId, int type, int freezeCount, Long userId);

    void freezeStock(Long productId, Long userId);

    List<ShopStockRecordDto> getStockRecord(Long productId, Long storageId, Integer type, String quantityType);
}
